gtksearchbar: Do not handle captured events for unmapped bars
authorCarlos Garnacho <carlosg@gnome.org>
Mon, 18 Feb 2019 19:00:19 +0000 (20:00 +0100)
committerCarlos Garnacho <carlosg@gnome.org>
Wed, 20 Feb 2019 12:15:16 +0000 (13:15 +0100)
If the bar is currently unmapped, it should not attempt to capture
and handle events.

Related: https://gitlab.gnome.org/GNOME/gtk/issues/1205

gtk/gtksearchbar.c

index 0b3f916344c016b418156d592303ca9b8408943c..7c0222ef606174c118034ef675518863210f9c37 100644 (file)
@@ -643,6 +643,9 @@ capture_widget_key_handled (GtkEventControllerKey *controller,
   GtkSearchBarPrivate *priv = gtk_search_bar_get_instance_private (bar);
   gboolean handled;
 
+  if (!gtk_widget_get_mapped (GTK_WIDGET (bar)))
+    return GDK_EVENT_PROPAGATE;
+
   if (priv->reveal_child)
     return GDK_EVENT_PROPAGATE;